// Script assets have changed for v2.3.0 see
// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information
function scr_create_maze(_x,_y){
	//_x标记地图的横坐标
	//_y标记地图的纵坐标
	//随机选择方向
	randomize();
	var _dir=choose(0,90,180,270);
	var _dx=lengthdir_x(1,_dir);
	var _dy=lengthdir_y(1,_dir);
	
	if(!scr_can_through(_x+_dx,_y+_dy))exit;//如果不能通过则退出
	else
	{
		map_show_grid_[# _x*2+1+_dx,_y*2+1+_dy]=FLOOR;//连通所要选择的下一个网格
		//更新当前标记地图网格坐标
		_x+=_dx;
		_y+=_dy;
		//将更新后的网格标记为1
		map_stamp_grid_[# _x,_y]=1;
		//标记过的网格数量+1
		map_stamp_number++;
		
	}
	
	
	//递归，回溯
	while(map_stamp_number<MAP_STAMP_HEIGHT*MAP_STAMP_WIDTH)
	{
		if(scr_can_choose(_x,_y))//如果当前坐标不是死路一条
		{
			scr_create_maze(_x,_y);
		}
		else
		{
			break;	
		}
	}
	
	
	

}